package com.chenyu.fallback;

import com.chenyu.client.UserClients;
import com.chenyu.enums.SystemErrorCode;
import com.chenyu.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author 晴
 * @version 1.0
 * @description:
 * @date 2024/7/20 17:56
 */
@Component
public class UserClientsFallbackFactory implements FallbackFactory<UserClients> {

    public UserClients create(Throwable throwable) {
        throwable.printStackTrace();
        return new UserClients() {
            public AjaxResult getByPhone(String phone) {
                return AjaxResult.error(SystemErrorCode.RESPONSE_CODE_500);
            }
        };
    }
}
